The present application relates generally to an improved data processing apparatus and method and more specifically to an apparatus and method for generating Structured Query Language/Extensible Markup Language (SQL/XML) statements.
The development of the relational data model together with well-defined concepts for data normalization, relational algebra, and query optimization, has laid the foundation for the extensive commercial success of relational databases. A corner stone of that success is the Structured Query Language (SQL). Today, commercial applications in practically every industry rely heavily on SQL and relational databases. For many companies, these applications include business critical systems and constitute a tremendous investment. Thus, today's database professionals, such as database administrators and database application developers, typically have a skill set that is heavily geared towards relational databases and SQL.
In recent years Extensible Markup Language (XML) has continued to emerge as the de-facto standard for data exchange. The main reasons for the emergence include that XML is extensible, flexible, and self-describing while remaining vendor and platform independent. The XML data model is suited for any combination of structured, unstructured, and semi-structured data. Also, XML documents may be queried, transformed, and validated through widely available tools and standards such as XML parsers, XQuery, XSLT, and XML Schema. Many enterprises also store large amounts of business data permanently as XML. Reasons include auditing requirements, regulatory compliance, or the fact that XML can sometimes be a more suitable data model than a relational schema. For example, data that have a high degree of variability and whose structure may evolve over time are often easier to handle in XML than in relational format. The easier handling is because a relational database schema has a very fixed rigorous definition while XML provides more flexibility.
In response to these needs, the major relational database vendors have added XML capabilities to their products. Additionally, the SQL standard has been extended to include an XML data type as well as XML-specific functions and predicates. This is called SQL/XML. The functions XMLQUERY and XMLTABLE as well as the predicate XMLEXISTS allow users to include XPath or XQuery expressions in their SQL statements. The functions and predicate enable applications to query or update XML and relational data in an integrated manner. This is necessary because most companies do not manage XML data separately from their relational data. Instead, a hybrid database design is commonly used where tables contain a mix of XML and relational columns.
The adoption of SQL/XML faces several challenges. Many relational legacy applications, based on SQL, require access to the increasing amount of XML data. However, converting legacy applications from SQL to SQL/XML is often too expensive, time consuming, or risky. Another challenge is to actually formulate queries and updates against XML data. XQuery and SQL/XML are relatively new compared to SQL and the use of XQuery and SQL/XML poses a number of problems:                Users need to learn these new languages which are often perceived as difficult to master. The difficulty stems from the differences between the XML data model and the relational data model.        XQuery and SQL/XML involve path expressions which navigate the tree structure of XML documents. To formulate path expressions, users need detailed knowledge about the structure of the XML data. Knowing which data items exist may not be enough. That is, knowing the exact case-sensitive name, namespace, and location of the data items within the hierarchical document structure may also be necessary. However, the hierarchical document structure is often complex, difficult to understand, or even unknown to the user.        As more XML documents are accumulated in a database, newer documents may have a different XML Schema than older ones. This requires queries and updates to work across documents for different schemas and compounds the complexity of writing SQL/XML statements. Also, existing XML queries may need to be changed because existing XML queries might return incorrect or incomplete results when the XML Schema evolves.        In a hybrid database, where some data is stored in relational format and some in XML format, users need to know which data is in which format before the users may write correct queries.        
These issues make writing correct SQL/XML statements often difficult, sometimes even impossible, for users.